﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

//using PowerCreator.LMS.Logic.ProjectManager;
//using PowerCreator.LMS.Logic.Common;
//using PowerCreator.LMS.Logic.FusionCharts;

public partial class sysadmin_CountManager_AllClassPass : PowerCreator.LMS.Web.Base.BasePage
{
    #region XML数据模版 ？为什么不采用模版的方式，新建了FusionCharts类，但是不能用

    //图表抬头 Title, xAxisName=X轴的名称，yAxisName=y轴显示的名称,yAxisMaxValue=y轴最大值
    const string GRAPH = "<graph  caption='班级通过率统计'  xAxisName='通过率值' yAxisName='班级名称列表' decimalPrecision='0' formatNumberScale='0' yAxisMaxValue='100' baseFontSize='14'> ";
    //名称，值，颜色
    const string GRAPH_TR = "<set name='{0}' value='{1}' color='{2}' />";
    const string GRAPH_END = "</graph>";
    //const string REPORT_URL = "/FusionCharts/FCF_Column3D.swf";

    const string CHART = "<chart caption='班级通过率统计' xAxisName='通过率值' yAxisName='班级名称列表' showValues='0' decimals='0' formatNumberScale='0' yAxisMaxValue='100' baseFontSize='14'>";
    const string CHART_TR = "<set name='{0}' value='{1}'/>";
    const string CHART_END = "</chart>";

    #endregion 

    //ManagerProjectHistoryInfo projectHistoryManager = new ManagerProjectHistoryInfo();
    //ManagerClassInfo classManager = new ManagerClassInfo();
    //ManagerProjectInfo projectManager = new ManagerProjectInfo();
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //string xml = GetXML();
            //if (string.IsNullOrEmpty(xml))
            //{
            //    Literal1.Text = "目前人员库还没有可以进行统计的数据！";
            //}
            //else
            //{
            //    Literal1.Text = InfoSoftGlobal.FusionCharts.RenderChartHTML(FCTemplate.GetColumn3D(), "", xml, "myxml", "800", "400", false);
            //}
        }
    }

    public DataTable GetAllClass()
    {
        //返回班级统计信息
        DataTable dt = new DataTable();
       // dt = classManager.Query("");
        return dt;
    }
    public string GetXML()
    {
        //返回班级通过率的XML数据
        StringBuilder sbXml = new StringBuilder();
        //sbXml.Append(GRAPH);
        //sbXml.Append(CHART);
        //DataTable dt = GetAllClass();

        //int passv = 0;
        //int maxv = 0;
        //int showv = 0;
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    passv = GetClassPassCount(int.Parse(dt.Rows[i]["ClassID"].ToString()), 3);
        //    maxv = GetClassUserCount(dt.Rows[i]["ClassID"].ToString());

        //    if (passv == 0)
        //        showv += 1;
        //    //名称，值，颜色
        //    passv = ReportUtils.GetBaiFenBi(passv.ToString(),maxv.ToString());
        //   // sbXml.Append(string.Format(GRAPH_TR, dt.Rows[i]["ClassName"].ToString(), passv, ReportUtils.GetColorRander(6)));
        //    sbXml.Append(string.Format(CHART_TR, dt.Rows[i]["ClassName"].ToString(), passv));
        //}
        ////sbXml.Append(GRAPH_END);
        //sbXml.Append(CHART_END);
        ////if (showv == dt.Rows.Count)
        ////{
        ////    sbXml.Remove(0, sbXml.Length);
        ////}
        return sbXml.ToString();
    }
    public int GetClassUserCount(string classid)
    {
        //string search = string.Format(" and ClassID={0}",classid);
        //return projectManager.UserStudentProjectListCount(search);    
        return 0;
    }

    public int GetClassPassCount(int classid,int ispass)
    {
        //string search = string.Format("ClassID={0} and State={1}", classid.ToString(), ispass.ToString());
        //return projectHistoryManager.Count(search);
        return 0;
    }

}
